<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/resources/css/main.css">
</head>
<body>

	<a href="add">上传文件</a>
	<table border="1" width="500">
		<tr>
			<th>编号</th>
			<th>文件名</th>
			<th>后缀</th>
			<th>大小</th>
			<th>操作</th>
		</tr>

		<c:forEach items="${attachments }" var="attach">
			<tr>
				<td>${attach.id }</td>
				<td><a
					href="/SSM/resources/upload/${attach.newName }.${attach.suffix}">${attach.oldName }</a></td>
				<td>${attach.suffix }</td>
				<td width="100"><c:if test="${attach.size  lt 1024}">${attach.size } B</c:if>
					<c:if test="${attach.size ge 1024  }">
						<fmt:formatNumber value="${attach.size /1024 }" /> K</c:if></td>
				<td><a href="delete/${attach.id}">删除</a></td>
			</tr>
		</c:forEach>
	</table>

</body>
</html>